<%@page language="java" contentType="text/html; charset=utf-8"%>
<%@include file="/commons/inc.jsp" %>
<script type="text/javascript" src="${contextPath}/js/ajax.js"></script>

<h3 id="navTitleId">营养治疗:</h3>

<body id="body">

<%@include file="/commons/showmessage.jsp" %>

	<table border="0" cellspacing="1" cellpadding="0" class="formTable" width="100%" >
	<tbody>	 
	<tr>
	 	<td align="left" class="form-td"><label class="label">开始时间:</label></td>
	 	<td align="left" class="form-td"><input type="text"  class="Wdate" size="15" value="${nutriTreat.starttime}" onClick="WdatePicker()" name="nutriTreat.starttime" id="nutriTreat.starttime"/></td>
	 	<td align="left" class="form-td"><label class="label">结束时间:</label></td>
	 	<td align="left" class="form-td"><input type="text"  class="Wdate" size="15" value="${nutriTreat.endtime}" onClick="WdatePicker()" name="nutriTreat.endtime" id="nutriTreat.endtime"/></td>	
	 	<td align="left" class="form-td" colspan="4"><input type="button" onclick="saveEdit(${nutriTreat.patientid});" value="保存"></td>
	 </tr>
	<tr>
		<td align="left" class="form-td"  ><label class="label">是否适合吃水果:</label></td>
		<td align="left" class="form-td" colspan="2"><input type="text" name="nutriTreat.suitfruit" id="nutriTreat.suitfruit"  readonly="readonly" size="4" <s:if test="nutriTreat.suitfruit==1">value="是"</s:if> <s:elseif test="nutriTreat.suitfruit==0">value="否"</s:elseif>/></td>
		<td align="left" class="form-td" ><label class="label">是否限制主食摄入量:</label></td>
		<td align="left" class="form-td" colspan="4"><input type="text" name="nutriTreat.limitmeal" id="nutriTreat.limitmeal"  readonly="readonly" size="4"  <s:if test="nutriTreat.limitmeal==1">value="是"</s:if> <s:elseif test="nutriTreat.limitmeal==0">value="否"</s:elseif>/></td>
	</tr>
	 
	<tr>
		<td align="left" class="form-td"><label class="label">能量供给量:</label> 
		 <input type="text" name="nutriTreat.energyamount" id="nutriTreat.energyamount"  size="4" readonly="readonly" value="${nutriTreat.energyamount}"/>kcal&nbsp;&nbsp;&nbsp;&nbsp;</td>
		<td align="left" class="form-td" colspan="7"><label class="label">能量水平:</label> 
		 <input type="text" name="nutriTreat.energylevel" id="nutriTreat.energylevel"  size="4" readonly="readonly" value="${nutriTreat.energylevel}"/>kcal&nbsp;&nbsp;&nbsp;&nbsp;</td>
	</tr>
	 
	<tr>
		<td align="left" class="form-td"  ><label class="label">蛋白质:</label>
			<input type="text" name="nutriTreat.danbaik" id="nutriTreat.danbaik"  size="4" readonly="readonly" value="${nutriTreat.danbaik}"/>g	
			<input type="text" name="nutriTreat.danbaip" id="nutriTreat.danbaip"  size="4" readonly="readonly" value="${nutriTreat.danbaip}"/>%&nbsp;&nbsp;&nbsp;&nbsp;</td>	
		<td align="left" class="form-td" colspan="2"><label class="label">糖类:</label>
			<input type="text" name="nutriTreat.tangk" id="nutriTreat.tangk"  size="4" readonly="readonly" value="${nutriTreat.tangk}"/>g
			<input type="text" name="nutriTreat.tangp" id="nutriTreat.tangp"  size="4" readonly="readonly" value="${nutriTreat.tangp}"/>%&nbsp;&nbsp;&nbsp;&nbsp;</td>	
		<td align="left" class="form-td" colspan="5"><label class="label">脂类:</label>
			<input type="text" name="nutriTreat.zhik" id="nutriTreat.zhik" size="4"  readonly="readonly" value="${nutriTreat.zhik}"/>g
			<input type="text" name="nutriTreat.zhip" id="nutriTreat.zhip"  size="4" readonly="readonly" value="${nutriTreat.zhip}"/>%</td>		
	</tr>
    <tr>
      	<td align="center" class="form-th">食物类别</td>
      	<td align="center" class="form-th">谷薯类(主食)</td>
      	<td align="center" class="form-th">蔬菜类</td>
      	<td align="center" class="form-th">鱼肉蛋类</td>
      	<td align="center" class="form-th">豆类</td>
      	<td align="center" class="form-th">乳类</td>
      	<td align="center" class="form-th">水果类</td>
      	<td align="center" class="form-th">油脂类</td>
      </tr>
     
      <tr>
         <td align="left" class="form-td">交换份</td>
         <td align="left" class="form-td"><input type="text" name="nutriTreat.zhushif" id="nutriTreat.zhushif" size="8" readonly="readonly" value="${nutriTreat.zhushif}"/></td>  
         <td align="left" class="form-td"><input type="text" name="nutriTreat.shucaif" id="nutriTreat.shucaif"  size="4" readonly="readonly" value="${nutriTreat.shucaif}"/></td>  
         <td align="left" class="form-td"><input type="text" name="nutriTreat.yurouf" id="nutriTreat.yurouf"  size="4" readonly="readonly" value="${nutriTreat.yurouf}"/></td>
         <td align="left" class="form-td"><input type="text" name="nutriTreat.douf" id="nutriTreat.douf"  size="4" readonly="readonly" value="${nutriTreat.douf}"/></td>
         <td align="left" class="form-td"><input type="text" name="nutriTreat.ruf" id="nutriTreat.ruf"  size="4" readonly="readonly" value="${nutriTreat.ruf}"/></td>
         <td align="left" class="form-td"><input type="text" name="nutriTreat.shuiguof" id="nutriTreat.shuiguof"  size="4" readonly="readonly" value="${nutriTreat.shuiguof}"/></td>  
         <td align="left" class="form-td"><input type="text" name="nutriTreat.youzhif" id="nutriTreat.youzhif"  size="4" readonly="readonly" value="${nutriTreat.youzhif}"/></td>
     </tr>
     <tr>
         <td align="left" class="form-td">食用量</td>
         <td align="left" class="form-td"><input type="text" name="nutriTreat.zhushig" id="nutriTreat.zhushig"  size="8" readonly="readonly" value="${nutriTreat.zhushig}"/></td>  
         <td align="left" class="form-td"><input type="text" name="nutriTreat.shucaig" id="nutriTreat.shucaig"  size="4" readonly="readonly" value="${nutriTreat.shucaig}"/></td>  
         <td align="left" class="form-td"><input type="text" name="nutriTreat.yuroug" id="nutriTreat.yuroug"  size="4" readonly="readonly" value="${nutriTreat.yuroug}"/></td>
         <td align="left" class="form-td"><input type="text" name="nutriTreat.doug" id="nutriTreat.doug"  size="4" readonly="readonly" value="${nutriTreat.doug}"/></td>
         <td align="left" class="form-td"><input type="text" name="nutriTreat.rug" id="nutriTreat.rug"  size="4" readonly="readonly" value="${nutriTreat.rug}"/></td>
         <td align="left" class="form-td"><input type="text" name="nutriTreat.shuiguog" id="nutriTreat.shuiguog"  size="4" readonly="readonly" value="${nutriTreat.shuiguog}"/></td>  
         <td align="left" class="form-td"><input type="text" name="nutriTreat.youzhik" id="nutriTreat.youzhik"  size="4" readonly="readonly" value="${nutriTreat.youzhik}"/></td>
     </tr>
    
	<tr>
		<td align="left" class="form-td" colspan="8">膳食推荐类型：<b><s:if test="recommend==1">限制碳水化合物饮食</s:if>
			<s:elseif test="recommend==2">低碳水化合物饮食</s:elseif>
			<s:elseif test="recommend==3">一般饮食</s:elseif>
			<s:else>暂无推荐信息</s:else></b>
		</td>
	</tr>
	</tbody>
	</table>
<%@include file="/commons/tableSel.jsp" %>

</body>

<style type="text/css">
body {
	height: 100%;
	width: 100%;
}
</style>

<script>
function saveEdit(id){
	var ajax = new postAjax();
	var a = $('nutriTreat.starttime').value;
	var b = $('nutriTreat.endtime').value;

	if(a && b && a!="" && b!=""){
		if(a>b){
			alert("结束时间不能小于开始时间");
			return;
		}
	}
	
	if(id!=null){
		url = "nutrition/nutrition.action?method=saveEditNutritionTreat&";
		value = "patientid=" + id + "&starttime="+a +"&endtime="+b;
		ajax.connect(url,value,saveCallback);
	}
}
function saveCallback(xmlHttp){
	var re = xmlHttp.responseText;
	if(re=="1"){
		showSuccess($('statusBar'), "保存完毕!");
		return;
	}else{
		showError($('statusBar'), "保存异常");	
		return;
	}
}
</script>